#!/bin/sh

# Copyright (C) 2008 Arthur Henrique Penteado Furlan <arthur.furlan@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# On Debian systems, you can find the full text of the license in
# /usr/share/common-licenses/GPL-2

# user agent used to request the page
USER_AGENT='Mozilla/5.0'

# site used to get the external ip address, you could use any site that returns
# a page containing your external ip address on it
SITE_URL='http://meuip.com.br'

# regex used to extract the ip address from the page
SITE_REGEX='^.*<strong class="IP">\(.*\)<\/strong>.*$'

# let's do the magic! :)
wget -q --header="User-Agent: $USER_AGENT" $SITE_URL -O - | \
    sed -n "s/$SITE_REGEX/\1/ p"
